#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll rr() {
    ll s = 0, w = false, c = getchar();
    for (; !isdigit(c); c = getchar())
        w = w || c == '-';
    for (; isdigit(c); c = getchar())
        s = s * 10 + c - '0';
    return w ? -s : s;
}

// END OF HEADER

struct Cake {
    double num, price, u;
    bool operator<(Cake& o) {
        return u > o.u;
    }
};

int main() {
    int n;
    double d;
    cin >> n >> d;
    vector<Cake> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i].num;
    }
    for (int i = 0; i < n; i++) {
        cin >> v[i].price;
        v[i].u = v[i].price / v[i].num;
    }
    sort(v.begin(), v.end());
    double sum = 0;
    for (int i = 0; i <= n - 1; i++) {
        if (d >= v[i].num) {
            sum += v[i].price;
            d -= v[i].num;
        } else {
            sum += d * v[i].u;
            break;
        }
    }

    printf("%.02lf\n", sum);
    return 0;
}
